package Connection;

import java.time.LocalDateTime;
import java.util.List;

import org.junit.jupiter.api.Test;

import com.zx.dao.UserTableOperation;
import com.zx.entity.UserEntity;

public class UserTableOperationTest {
		private static UserTableOperation uto = new UserTableOperation();
		
		@Test
		public void testQuery() {
			List<UserEntity> list=uto.queryAll();
			list.forEach((item)->System.out.println(item.getName()+","+item.getPassword()));
			
			UserEntity user = uto.queryById(2);
			System.out.println(user.getName()+","+user.getPassword());
		}
		
		@Test
		public void testAdd() {
			UserEntity user =new UserEntity(1,"AA","bb","0",LocalDateTime.now());
			int num=uto.add(user);
			System.out.println(num);
		}
		
		@Test
		public void testDelete() {
			UserEntity user=uto.queryById(3);
			System.out.println(user.getName()+","+user.getPassword());
			int num=uto.delete(3);
			System.out.println(num);
		}
		
		@Test
		public void testUpdate() {
			UserEntity user =new UserEntity(5,"AA","BB","0",LocalDateTime.now());
			int num=uto.update(user);
			System.out.println(num);
		}
}
